# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=openipmi
pkgver=2.0.29
pkgrel=0
pkgdesc="IPMI (Intelligent Platform Management Interface) library and tools"
url="https://sourceforge.net/projects/openipmi/"
arch="all"
license="LGPL-2.0-or-later and GPL-2.0-or-later or BSD-3-Clause"
makedepends="libedit-dev readline-dev popt-dev glib-dev net-snmp-dev ncurses-dev
	openssl-dev linux-headers"
subpackages="$pkgname-dev $pkgname-doc $pkgname-lanserv $pkgname-libs"
source="https://downloads.sourceforge.net/openipmi/OpenIPMI-$pkgver.tar.gz"
builddir="$srcdir"/OpenIPMI-$pkgver

prepare() {
	default_prepare
	update_config_sub
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--localstatedir=/var \
		--disable-static \
		--with-ucdsnmp \
		--without-python
	make
}

package() {
	make -j1 DESTDIR="$pkgdir" install
}

lanserv() {
	pkgdesc="Emulates an IPMI network listener"
	mkdir -p "$subpkgdir"/usr/bin "$subpkgdir"/usr/lib
	mv "$pkgdir"/etc "$subpkgdir"/
	mv "$pkgdir"/usr/lib/libIPMIlanserv.so.* "$subpkgdir"/usr/lib/
	mv "$pkgdir"/usr/bin/ipmilan \
		"$pkgdir"/usr/bin/ipmi_sim \
		"$pkgdir"/usr/bin/sdrcomp \
		"$subpkgdir"/usr/bin/
}



sha512sums="ff23aadfe4b9002574d1f06dda3d61f7a03ef1df2c61855516b7d67bd6d3272c53af74e3412e1045242dcb845f50b7c542083e918805c0efac424dd86e720a10  OpenIPMI-2.0.29.tar.gz"
